What does `const` do when combined with `readonly`?

Posted by Byron Sommardahl on Stack Overflow See other posts from Stack Overflow or by Byron Sommardahl
Published on 2010-04-09T23:36:57Z Indexed on 2010/04/09 23:43 UTC
Read the original article Hit count: 446

Filed under:
|

The difference between const and readonly is well covered. A const can't be changed and a read only can only be changed in a constructor. But, what happens when you combine the two:

public readonly const string how_does_this_behave = "I don't know";

The compiler allows it. But I'm not sure how it behaves from this point on. Thoughts?

© Stack Overflow or respective owner

Related posts about c#

Related posts about compiler